<template>
<!--    <div >-->
<!--        <el-table-->
<!--                :data="tableData"-->
<!--                style="width: 100%;margin-bottom: 20px;"-->
<!--                row-key="id"-->
<!--                :expand-row-keys="expands"-->
<!--                border-->
<!--                default-expand-all-->
<!--                :tree-props="{children: 'children', hasChildren: 'hasChildren'}">-->

<!--            <el-table-column-->
<!--                    prop="name"-->
<!--                    label="课程目录"-->
<!--                    width="180" >-->
<!--                <template slot-scope="scope">-->
<!--                    <el-tooltip :content="scope.row.opreateDetail" placement="top">-->
<!--                        <div class="spread-box" :style="{'-webkit-line-clamp':scope.row.spread ? '':3}">-->
<!--                            {{scope.row.opreateDetail}}-->
<!--                        </div>-->
<!--                    </el-tooltip>-->
<!--                    <div v-show="scope.row.spread==false" @click="spreadText(scope.row)" class="spread-btn">-->
<!--                        <el-button type="text">展开<el-icon class="el-icon-arrow-down"></el-icon></el-button>-->
<!--                    </div>-->
<!--                    <div v-show="scope.row.spread==true" @click="spreadText(scope.row)" class="spread-btn">-->
<!--                        <el-button type="text">收起<el-icon class="el-icon-arrow-up"></el-icon></el-button>-->
<!--                    </div>-->
<!--                </template>-->
<!--            </el-table-column>-->



<!--        </el-table>-->
<!--    </div>-->
</template>


<script>
    export default {
        name: "catalogue",
        components: "",
        props: "",
        data() {
            return {
                expands:[5],
                tableH: 0,
                tableData: [{
                    id: 1,
                    name: '课程1',
                }, {
                    id: 2,
                    name: '课程2',
                }, {
                    id: 3,
                    name: '课程3',
                    children: [{
                        id: 31,
                        name: '课程2-1',
                    }, {
                        id: 32,
                        name: '课程2-2'
                    }]
                }, {
                    id: 4,
                    name: '课程4',
                },
                    {
                        id: 5,
                        name: '课程5',
                    },{
                        id: 6,
                        name: '课程6',
                    }
                ],
            }
        },
        methods: {
            load(tree, treeNode, resolve) {
                setTimeout(() => {
                    resolve([
                        {
                            id: 31,
                            name: '课程2-1',
                        }, {
                            id: 32,
                            name: '课程2-2',
                        }
                    ])
                }, 1000)

            },
            byteCount(str) {
                const count = (str && str.replace(/[^\x00-\xff]/g, "xx").length) || 0;
                return count;
            },
            async operateLogList() {
                try {
                    var data ={
                        referenceId: this.$route.query.row.id,
                        pageNum: this.pageNum, //当前页
                        pageSize: this.pageSize//查询个数
                    }
                    const res = await operateLogList(data);
                    if (res.returnCode == "00000") {
                        var list=res.data.rows;
                        console.log(list,'list');
                        for (let i=0;i<list.length;i++){
                            if(this.byteCount(list[i].opreateDetail)>270){
                                list[i].spread=false;
                                console.log(123456789)
                            }
                        }
                        this.tableData=list;
                        console.log(this.tableData,666)
                        this.total=res.data.total;//总数
                    }else{
                        this.$message({
                            message: res.returnMessage,
                            type: 'error'
                        })
                    }
                } catch (err) {
                    this.$message({
                        message: "服务异常, 请稍后重试!!!",
                        type: 'error'
                    })
                }
            },

            spreadText(obj) {
                obj.spread = !obj.spread;
            },
        }}
</script>

<style scoped>

</style>